package service;

import java.util.List;

import dao.GoodDetailDao;
import entity.Goods;
import entity.GoodsLabel;

public class GoodsService {

	GoodDetailDao goodsDao = new GoodDetailDao();
	public void addGoods(Goods goods, GoodsLabel label) {
		goodsDao.addGoods(goods, label);
	}
	
	public List<Goods> getGoodByTwoClassId(int userId, int twoClassId) {
		return goodsDao.getGoodByTwoClassId(userId, twoClassId);
	}
	
	public Goods getGoodByGid(int goodId) {
		return goodsDao.getGoodByGid(goodId);
	}
	//获取所有
	public List<Goods> getGoodsAll() {
		return goodsDao.getGoodsAll();
	}
	
	public List<Goods> getGoodsByLike(String likeword) {
		return goodsDao.getGoodsByLike(likeword);
	}
	//分页操作，通过当前页数获取指定的商品
	public List<Goods> getGoodsByPage(int in1, int in2, String likeword) {
		return goodsDao.getGoodsByPage(in1, in2, likeword);	
	}
	
	//获取商品详细信息根据Id
	public Goods getGoodByGoodDetail(int goodId) {
		return goodsDao.getGoodByGoodDetail(goodId);
	}
	
	//获取一个商品商品根据Id有图片
	public Goods getGoodHaveImgByGid(int gid){
			return goodsDao.getGoodHaveImgByGid(gid);
	}
	
	//通过关键字获取有多少条记录数
	public int getCountByByLike(String likeword) {
		return goodsDao.getCountByByLike(likeword);
	}
}
